<template>
  <div class="topbar">
    <div class="wrap topwrap">
      <div class="left">欢迎来到叩丁狼积分商城</div>
      <ul class="nvs">
        <li>
          <img src="@/assets/img/userImg.f8bbec5e.png" alt="" class="imgs" />
          用户名：游客
        </li>
        <li>我的积分：--</li>
        <li>获取积分</li>
        <li>叩丁狼官网</li>
        <!-- 购物车和登录按钮  -->
        <li class="cart-btn" v-if="isLogined">
          <img src="../assets/img/cart.png" alt="" />
          <span>购物车</span>
          <strong>10</strong>
        </li>
        <li class="act" v-else @click="isShowLoginModalFn(true)">登录</li>
      </ul>
    </div>
  </div>
</template>

<script>
import { mapMutations, mapState } from "vuex";
export default {
  computed: {
    ...mapState({
      isLogined: (state) => state.LoginStatu.isLogined,
    }),
  },
  methods: {
    ...mapMutations({
      isShowLoginModalFn: "isShowMoadl/isShowLoginModalFn",
    }),
  },
};
</script>

<style lang="less" scoped>
.topbar {
  height: 40px;
  background: #242b39;
  line-height: 40px;
  .topwrap {
    display: flex;
    justify-content: space-between;
    .left {
      font-size: 14px;
      font-weight: 300;
      color: #fffefe;
    }
    .nvs {
      display: flex;
      justify-content: space-around;
      li {
        font-size: 14px;
        font-weight: 300;
        color: #fffefe;
        margin-left: 20px;
        cursor: pointer;
        .imgs {
          width: 23px;
          height: 22px;
          border-radius: 13px;
          vertical-align: middle;
        }
        &.act {
          width: 124px;
          height: 40px;
          background: #0a328e;
          text-align: center;
        }
        &.cart-btn {
          width: 124px;
          height: 40px;
          background: #0a328e;
          text-align: center;
          img {
            width: 20px;
            height: 19px;
            vertical-align: middle;
          }
          span {
            margin: 0 8px;
          }
          strong {
            width: 22px;
            height: 22px;
            line-height: 22px;
            display: inline-block;
            border-radius: 50%;
            background-color: #fd604d;
          }
        }
      }
    }
  }
}
</style>